<%--
	get all use column in vtable.
	this page need a parameter 'vtablename'.
	this page has a output parameter 'allcolumn' return all column is usable in this vtable
--%>
<%@ page import="com.oval.foundation.metadata.engine.OvalColumn,
				com.oval.foundation.metadata.engine.OvalVTable,
				com.oval.foundation.container.VTableContainer" %>
<%
	String vtablename = (String)pageContext.getAttribute("vtablename");
	Vector pageconfigdetails = (Vector)pageContext.getAttribute("pageconfigdetails");
	if(pageconfigdetails == null) pageconfigdetails = new Vector();
	Vector returnVector = new Vector();
	if(vtablename != null){
		OvalVTable m_vtable = VTableContainer.findVTableMeta(vtablename);
		if(m_vtable != null){
			Iterator cols = m_vtable.getColumns();
				
			while (cols.hasNext())
			{
			  OvalColumn col = (OvalColumn)cols.next();
			  HashMap colHash = new HashMap();
			  boolean notExists = true;
			  for(int i=0 ;i<pageconfigdetails.size();i++){
			  	  HashMap onedetail = (HashMap)pageconfigdetails.get(i);
			  	  if(((String)onedetail.get("fieldname")).equals(col.getColDesc())){
			  	  	notExists = false;
			  	  	break;
			  	  }
			  }
			  if (col.getIsUsable().booleanValue() && notExists ){
				  	colHash.put("coldesc",col.getColDesc());
				    returnVector.add(colHash);
			  }
			}
		}
	}
	
	pageContext.setAttribute("allcolumn",returnVector);
	
%>